package com.twetec.cms.adapter.pc.backend.config;

import com.twetec.cms.adapter.pc.backend.constant.RabbitMQConstants;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Administrator
 * @version 1.0
 * @create 2018-07-12 9:04
 **/
@Configuration
public class RabbitMQConfiguration {

    @Bean
    public Queue siteDeployQueue(){
        return new Queue(RabbitMQConstants.SITE_DEPLOY_QUEUE_NAME);
    }

    @Bean
    FanoutExchange siteDeployFanoutExchange() {
        return new FanoutExchange(RabbitMQConstants.SITE_DEPLOY_FANOUT_EXCHANGE_NAME);
    }

    @Bean
    Binding bindingExchangeA(Queue siteDeployQueue, FanoutExchange siteDeployFanoutExchange) {
        return BindingBuilder.bind(siteDeployQueue).to(siteDeployFanoutExchange);
    }

}
